﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace SmartMathLibrary.Management
{
    /// <summary>
    /// This class provides methods to find out the methods of a class instance.
    /// </summary>
    [Serializable]
    public class MethodAnalyzer : AbstractAnalyzer
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MethodAnalyzer"/> class.
        /// </summary>
        /// <param name="analyzerObject">The object to analyze.</param>
        public MethodAnalyzer(Object analyzerObject)
            : base(analyzerObject)
        {
        }

        /// <summary>
        /// Analyzes the methods of the specified class instance.
        /// </summary>
        /// <returns>The methods of the specified class instance.</returns>
        public MethodInfo[] AnalyzeMethods()
        {
            Type analyzerType = this.AnalyzerObject.GetType();

            return analyzerType.GetMethods(BindingFlags.NonPublic
                                           | BindingFlags.Instance | BindingFlags.Public);
        }
    }
}